Skip to content

fix(idempotency): treat missing idempotency key as non-idempotent transaction (no-op) when raise_on_no_idempotency_key is False #2477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #2465

Summary

Changes

This PR addresses the issue where idempotency data could be inadvertently persisted when the corresponding idempotency key is missing. This fix prevents any potential inconsistencies or undesired outcomes that may occur due to missing idempotency keys.

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner June 16, 2023 00:21
@leandrodamascena leandrodamascena requested review from heitorlessa and removed request for a team June 16, 2023 00:21
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation tests labels Jun 16, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 16, 2023
@github-actions github-actions bot added the bug Something isn't working label Jun 16, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2023

Codecov Report

Patch coverage: 73.68% and project coverage change: -0.26 ⚠️

Comparison is base (80dfdd0) 97.22% compared to head (89fa121) 96.96%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2477      +/-   ##
===========================================
- Coverage    97.22%   96.96%   -0.26%     
===========================================
  Files          157      157              
  Lines         7306     7212      -94     
  Branches       523      514       -9     
===========================================
- Hits          7103     6993     -110     
- Misses         158      168      +10     
- Partials        45       51       +6     
Impacted Files Coverage Δ
...ws_lambda_powertools/utilities/idempotency/base.py 98.66% <66.66%> (-1.34%) ⬇️
...wertools/utilities/idempotency/persistence/base.py 97.15% <75.00%> (-2.24%) ⬇️

... and 25 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor Author

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @heitorlessa! I made some comments, please take a look.

@heitorlessa
Copy link
Contributor

looking

@heitorlessa
Copy link
Contributor

LGTM, sending an E2E test to be triple sure

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 16, 2023
Signed-off-by: Heitor Lessa <[email protected]>
Signed-off-by: Heitor Lessa <[email protected]>
Signed-off-by: Heitor Lessa <[email protected]>
@heitorlessa heitorlessa changed the title fix(idempotency): prevent persist idempotency data when the idempotency key is missing. fix(idempotency): treat missing idempotency key as non-idempotent transaction (no-op) when raise_on_no_idempotency_key is False Jun 16, 2023
@leandrodamascena leandrodamascena merged commit d652dc2 into aws-powertools:develop Jun 16, 2023
sthulb pushed a commit that referenced this pull request Jun 19, 2023
…nsaction (no-op) when raise_on_no_idempotency_key is False (#2477)

* bug: fix missing idempotency key

* fix return

* chore: add e2e test for optional idempotency key

* chore: fix e2e third payload

* docs: clarify operations

Signed-off-by: Heitor Lessa <[email protected]>

* chore: clarify warning

Signed-off-by: Heitor Lessa <[email protected]>

* chore: strip extra space

Signed-off-by: Heitor Lessa <[email protected]>

* chore: ignore long warning line

---------

Signed-off-by: Heitor Lessa <[email protected]>
Co-authored-by: heitorlessa <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]>
rafaelgsr pushed a commit to rafaelgsr/aws-lambda-powertools-python that referenced this pull request Jun 30, 2023
…nsaction (no-op) when raise_on_no_idempotency_key is False (aws-powertools#2477)

* bug: fix missing idempotency key

* fix return

* chore: add e2e test for optional idempotency key

* chore: fix e2e third payload

* docs: clarify operations

Signed-off-by: Heitor Lessa <[email protected]>

* chore: clarify warning

Signed-off-by: Heitor Lessa <[email protected]>

* chore: strip extra space

Signed-off-by: Heitor Lessa <[email protected]>

* chore: ignore long warning line

---------

Signed-off-by: Heitor Lessa <[email protected]>
Co-authored-by: heitorlessa <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Treat missing idempotency key as non-idempotent transaction
3 participants